www.gusucode.com > 粒子滤波全套源代码,实现了粒子滤波的全部功能,是粒子滤波提高级程序 > particle filter program/weight.m
function w=weight(p,q,sita) % given the standard deviaton sita, and the Bhattacharyya distacne d of two % color hisgrams(one of them is the target's, the other is the sample's), % the function return the sample's coresponding weight. % This weighting data is the base for the tracking algorithem m=512; simi=0; for i=1:1:m; simi=simi+(p(i)*q(i))^0.5; end d=(1-simi)^0.5; w=(1/(sita*(2*pi)^0.5))*exp(-(d^2)/(2*sita^2)); %w=simi; %更有利于理想实验,不同背景的为零 return